<?php 
session_start();	
if ($_POST['pwd']!=$_POST['pwd1']) {
	die( "<script>alert('两次密码不一致');window.location.href='zhuce.php'</script>");
}
if (strtolower($_POST['yzm']) !=strtolower($_SESSION['yzm']) ) {
	die( "<script>alert('验证码错误');window.location.href='zhuce.php'</script>");
}
include_once('function.php');
$config = include_once('config.php');

$aa['uname'] = $_POST['uname'];
$aa['pwd'] = md5($_POST['pwd']);

unset($aa['pwd1']);
 $res = add($config,'homeusers',$aa);
if ($res) {
echo "<script>alert('注册成功');window.location.href='login.php'</script>";
}
else{
	echo "<script>alert('注册失败');window.location.href='zhuce.php'</script>";
}


 ?>